package com.pg.agent.engine.client.common.enums;

import java.util.Arrays;

/**
 * 组件参数获取方式
 *1.默认值 2.大模型提取，3.用户输入。4.组件输入。6.系统参数，7.自定义
 * @author huhuaping
 * @date 2023/11/24 9:41
 */
public enum ComponentArgGetWayEnum {
    DEFAULT(1, "default", "默认值"),
    LLM_MODEL(2, "llmModel", "大模型提取"),
    USER_INPUT(3, "USER_INPUT", "用户输入"),
    COMPONENT_INPUT(4, "COMPONENT_INPUT", "组件输入"),
    SYS_PARAM(6, "SYS_PARAM", "系统参数"),
    CUSTOM(7, "CUSTOM", "自定义"),
    TOKEN_PARAM(8, "TOKEN_PARAM", "鉴权参数")
    ;

    /**
     * 值
     */
    private Integer value;
    /**
     * 编码
     */
    private String code;
    /**
     * 说明
     */
    private String desc;

    ComponentArgGetWayEnum() {

    }

    ComponentArgGetWayEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    ComponentArgGetWayEnum(Integer value, String code, String desc) {
        this.value = value;
        this.code = code;
        this.desc = desc;
    }

    public static String getCodeByValue(Integer value) {

        ComponentArgGetWayEnum controllerTypeEnum = Arrays.stream(values()).filter(e -> e.value.equals(value)).findFirst().orElse(null);

        return controllerTypeEnum == null ? "" : controllerTypeEnum.code;
    }

    public Integer getValue() {
        return value;
    }


    public String getDesc() {
        return desc;
    }


    public String getCode() {
        return code;
    }

}
